/**
 * Created by jiachenpan on 16/11/18.
 */

export function isvalidUsername(str) {
  if (!str) {
    return false
  } else {
    return str.length > 1 && str.length < 16
  }
}

export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

export function isMobile(str) {
  return /^((19[0-9])|(16[0-9])|(17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\D])|(18[0-9]))\d{8}$/.test(str)
}

export function isValidPassword(str) {
  return /^[a-zA-Z0-9]{6,16}$/.test(str)

}

export function isValidImageCode(str) {
  if (!str) {
    return false
  } else if (str.length != 5) {
    return false
  } else {
    return true
  }
}

export function isVaildMsgAuthCode(num) {
  return /^\d{6}$/.test(num)
}
